package com.baizhi.service.impl;

import com.baizhi.dao.CategoryDao;
import com.baizhi.entity.Category;
import com.baizhi.service.CategoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryDao categoryDao;
    @Override
    @Transactional(readOnly = true)
    public PageInfo<Category> selectByPage(Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        PageInfo<Category> pageInfo = new PageInfo<>(categoryDao.selectAll());
        return pageInfo;
    }
}
